package core.query;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import core.query.filter.ISqlFilter;
import core.transcation.IContext;

public class QueryParam implements IContext, Serializable {

	private static final long serialVersionUID = -8997481772357422262L;

	private String groupOp;

	private List<QueryRule> rules;

	private List<ISqlFilter> sqlFilters;
	
	private Pagination pagination;
	
	private Object result;
	
	public boolean usePage() {
		return pagination != null;
	}

	public void addFilter(ISqlFilter sqlFilter) {
		if (sqlFilters == null) {
			this.sqlFilters = new ArrayList<ISqlFilter>();
		}
		sqlFilters.add(sqlFilter);
	}

	public Object getResult() {
		return result;
	}

	public void setResult(Object result) {
		this.result = result;
	}

	public Pagination getPagination() {
		return pagination;
	}

	public void setPagination(Pagination pagination) {
		this.pagination = pagination;
	}

	public List<ISqlFilter> getSqlFilters() {
		return sqlFilters;
	}

	public void setSqlFilters(List<ISqlFilter> sqlFilters) {
		this.sqlFilters = sqlFilters;
	}

	public String getGroupOp() {
		return groupOp;
	}

	public void setGroupOp(String groupOp) {
		this.groupOp = groupOp;
	}

	public List<QueryRule> getRules() {
		return rules;
	}

	public void setRules(List<QueryRule> rules) {
		this.rules = rules;
	}

}
